package cn.brilliantfuture.commentry.entity;

// Generated 2010-10-14 14:06:42 by Hibernate Tools 3.3.0.GA

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.OrderBy;
import org.hibernate.validator.Email;
import org.hibernate.validator.Length;

/**
 * OrderInformation generated by hbm2java
 */
@Entity
@Table(name = "order_information", catalog = "cabinet")
public class OrderInformation implements java.io.Serializable {

	private static final long serialVersionUID = 7887704255002444490L;
	private Integer orderInformationId;
	//订单编号
	private String number;
	// 订购人
	private Purchaser purchaser;
	//订购时间
	private Date insertTime;
	// 送货地址
	private String destination;
	// 收货人
	private String receiveName;
	// 收货人电话
	private String receivePhone;
	// 收货人email
	private String recevieEmail;
	private String originalCode;
	// 送货时间
	private Date deliveryTime;
	private Date deliveryEndTime;
	// 0未提交订单1未接受订单2订单处理中3订单完成（暂时无用的注释）
	//1未处理配送单 3备货完成 4已经完成送货 5已经完成的配送单（用户已经把货取走） 6配送在途（在3、4之间）
	private Integer transactions;

	private UserGroup group;
	// 支付方式
	private Integer paymentMode;
	private Integer orderType;
	private Integer easyStorageKey;
	// 配送柜
	private Lockers lockers;
	
	//温控类型
	private DataModels dataModels;
	
	// 订单备注
	private String orderRemark;
	// 实际支付金额
	private double totalAmount;

	private boolean deleted;
	
	//订单来源  0:商城； 1：配送平台
	private Integer orderSource;
	
	private ExpressInfo expressInfo;

	//温控范围
	private String dataModelValue;
	
	//存储类型 1 普通 2 保温 3 温控
	private int storeMode = 1;
	
	private Integer insertUser;
	
	private boolean effective = true;
	
	private boolean isManual;

	private ExpressPerson expressPerson;

	private OrderInformation orderInformation;

	private Set<OrderProductInfo> orderProductInfos = new HashSet<OrderProductInfo>(
			0);
	private Set<ProductBatch> productBatchs = new HashSet<ProductBatch>(0);
	
	private Set<RefundOrderInfo> refundOrderInfos = new HashSet<RefundOrderInfo>(0);
	
	private Set<WorkflowInfo> workflowInfos = new HashSet<WorkflowInfo>(0);
	
	private Set<OrderInformation> orderInformations = new HashSet<OrderInformation>(0);

	public OrderInformation() {
	}

	public OrderInformation(Integer orderInformationId, Purchaser purchaser,
			UserGroup group) {
		this.orderInformationId = orderInformationId;
		this.purchaser = purchaser;
		this.group = group;
	}

	public OrderInformation(Integer orderInformationId, String number,
			String receivePhone, String receiveEmail, Purchaser purchaser,
			Date insertTime, Integer transactions, boolean deleted,
			UserGroup group, String dataModelValue, int storeMode,DataModels dataModels,
			Set<OrderProductInfo> orderProductInfos, Set<RefundOrderInfo> refundOrderInfos, ExpressInfo expressInfo) {
		this.dataModelValue = dataModelValue;
		this.dataModels = dataModels;
		this.orderInformationId = orderInformationId;
		this.number = number;
		this.group = group;
		this.receivePhone = receivePhone;
		this.recevieEmail = receiveEmail;
		this.purchaser = purchaser;
		this.insertTime = insertTime;
		this.transactions = transactions;
		this.deleted = deleted;
		this.orderProductInfos = orderProductInfos;
		this.refundOrderInfos = refundOrderInfos;
		this.expressInfo = expressInfo;
		this.storeMode = storeMode;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "order_information_id", unique = true, nullable = false)
	public Integer getOrderInformationId() {
		return this.orderInformationId;
	}

	public void setOrderInformationId(Integer orderInformationId) {
		this.orderInformationId = orderInformationId;
	}

	@Column(name = "number", length = 50)
	@Length(max = 50)
	public String getNumber() {
		return this.number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	@ManyToOne
	@JoinColumn(name = "purchaser_id")
	public Purchaser getPurchaser() {
		return this.purchaser;
	}

	public void setPurchaser(Purchaser purchaser) {
		this.purchaser = purchaser;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "group_id")
	public UserGroup getGroup() {
		return group;
	}

	public void setGroup(UserGroup group) {
		this.group = group;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "insert_time", length = 19)
	public Date getInsertTime() {
		return this.insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	@Column(name = "transactions")
	public Integer getTransactions() {
		return this.transactions;
	}

	public void setTransactions(Integer transactions) {
		this.transactions = transactions;
	}

	@Column(name = "deleted")
	public boolean isDeleted() {
		return this.deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "orderInformation")
	@OrderBy(clause = " order_product_info_id desc")
	public Set<OrderProductInfo> getOrderProductInfos() {
		return this.orderProductInfos;
	}

	public void setOrderProductInfos(
			Set<OrderProductInfo> orderProductInfos) {
		this.orderProductInfos = orderProductInfos;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "orderInformation")
	public Set<ProductBatch> getProductBatchs() {
		return productBatchs;
	}

	public void setProductBatchs(Set<ProductBatch> productBatchs) {
		this.productBatchs = productBatchs;
	}

	@Column(name = "destination", length = 200)
	@Length(max = 200, message = "最多200个字符.")
	public String getDestination() {
		return destination;
	}

	public void setDestination(String destination) {
		this.destination = destination;
	}

	@Column(name = "receive_name", length = 50)
	@Length(max = 50, message = "最多50个字符.")
	public String getReceiveName() {
		return receiveName;
	}

	public void setReceiveName(String receiveName) {
		this.receiveName = receiveName;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "delivery_start_time", length = 19)
	public Date getDeliveryTime() {
		return this.deliveryTime;
	}

	public void setDeliveryTime(Date deliveryTime) {
		this.deliveryTime = deliveryTime;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "delivery_end_time", length = 19)
	public Date getDeliveryEndTime() {
		return this.deliveryEndTime;
	}

	public void setDeliveryEndTime(Date deliveryEndTime) {
		this.deliveryEndTime = deliveryEndTime;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "lockers_id")
	public Lockers getLockers() {
		return lockers;
	}

	public void setLockers(Lockers lockers) {
		this.lockers = lockers;
	}

	@Column(name = "order_remark")
	public String getOrderRemark() {
		return orderRemark;
	}

	public void setOrderRemark(String orderRemark) {
		this.orderRemark = orderRemark;
	}

	@Column(name = "total_amount")
	public double getTotalAmount() {
		return totalAmount;
	}

	public void setTotalAmount(double totalAmount) {
		this.totalAmount = totalAmount;
	}

	@Column(name = "receive_phone", length = 50)
	@Length(max = 11)
	public String getReceivePhone() {
		return receivePhone;
	}

	public void setReceivePhone(String receivePhone) {
		this.receivePhone = receivePhone;
	}

	@Column(name = "receive_email", length = 50)
	@Length(max = 50)
	@Email
	public String getRecevieEmail() {
		return recevieEmail;
	}

	public void setRecevieEmail(String recevieEmail) {
		this.recevieEmail = recevieEmail;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "orderInformation")
	public Set<RefundOrderInfo> getRefundOrderInfos() {
		return refundOrderInfos;
	}

	public void setRefundOrderInfos(Set<RefundOrderInfo> refundOrderInfos) {
		this.refundOrderInfos = refundOrderInfos;
	}
	
	@Column(name = "order_source")
	public Integer getOrderSource() {
		return orderSource;
	}

	public void setOrderSource(Integer orderSource) {
		this.orderSource = orderSource;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "express_info_id")
	public ExpressInfo getExpressInfo() {
		return expressInfo;
	}

	public void setExpressInfo(ExpressInfo expressInfo) {
		this.expressInfo = expressInfo;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "data_models_id")
	public DataModels getDataModels() {
		return dataModels;
	}

	public void setDataModels(DataModels dataModels) {
		this.dataModels = dataModels;
	}

	@Column(name = "data_model_value")
	public String getDataModelValue() {
		return dataModelValue;
	}

	public void setDataModelValue(String dataModelValue) {
		this.dataModelValue = dataModelValue;
	}

	@Column(name = "store_mode")
	public int getStoreMode() {
		return storeMode;
	}

	public void setStoreMode(int storeMode) {
		this.storeMode = storeMode;
	}

	@Column(name = "payment_mode")
	public Integer getPaymentMode() {
		return paymentMode;
	}

	public void setPaymentMode(Integer paymentMode) {
		this.paymentMode = paymentMode;
	}
	
	@Column(name = "original_code", length = 20)
	public String getOriginalCode() {
		return originalCode;
	}

	public void setOriginalCode(String originalCode) {
		this.originalCode = originalCode;
	}

	@Column(name = "order_type")
	public Integer getOrderType() {
		return orderType;
	}

	public void setOrderType(Integer orderType) {
		this.orderType = orderType;
	}

	@Column(name = "insert_user")
	public Integer getInsertUser() {
		return insertUser;
	}

	public void setInsertUser(Integer insertUser) {
		this.insertUser = insertUser;
	}
	
	@Column(name = "is_effective", nullable = false)
	public boolean isEffective() {
		return effective;
	}

	public void setEffective(boolean effective) {
		this.effective = effective;
	}
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "orderInformation")
	public Set<WorkflowInfo> getWorkflowInfos() {
		return workflowInfos;
	}

	public void setWorkflowInfos(Set<WorkflowInfo> workflowInfos) {
		this.workflowInfos = workflowInfos;
	}
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "orderInformation")
	public Set<OrderInformation> getOrderInformations() {
		return orderInformations;
	}

	public void setOrderInformations(Set<OrderInformation> orderInformations) {
		this.orderInformations = orderInformations;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parent_id")
	public OrderInformation getOrderInformation() {
		return orderInformation;
	}

	public void setOrderInformation(OrderInformation orderInformation) {
		this.orderInformation = orderInformation;
	}

	@Column(name = "is_manual")
	public boolean isManual() {
		return isManual;
	}

	public void setManual(boolean isManual) {
		this.isManual = isManual;
	}

	@Column(name = "easy_storage_key")
	public Integer getEasyStorageKey() {
		return easyStorageKey;
	}

	public void setEasyStorageKey(Integer easyStorageKey) {
		this.easyStorageKey = easyStorageKey;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "express_person_id")
	public ExpressPerson getExpressPerson() {
		return expressPerson;
	}

	public void setExpressPerson(ExpressPerson expressPerson) {
		this.expressPerson = expressPerson;
	}
}
